package com.thti.mecool.client.adapter;

import java.util.List;
import java.util.Map;

import android.app.Activity;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.thti.mecool.client.activity.R;

public class DraftAdapter extends BaseAdapter {

	private Context mContext;
    List<Map<String,String>> list;
    
	
	public DraftAdapter(Context mContext, List<Map<String, String>> list) {
		super();
		this.mContext = mContext;
		this.list = list;
	}


	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return list.size();
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return list.get(position);
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		View view =((Activity) mContext).getLayoutInflater().inflate(R.layout.mecool_draft_plan_item,null);
		TextView textView,textDate;
//		CheckBox checkBox;
		try {
//			checkBox=(CheckBox)view.findViewById(R.id.mecool_draft_plan_item_checked);
			textView=(TextView)view.findViewById(R.id.mecool_draft_plan_item_text);
			textDate=(TextView)view.findViewById(R.id.mecool_draft_plan_item_date);
//			if(DraftActivity.modify%2==1){
//				checkBox.setVisibility(View.VISIBLE);
//				textDate.setVisibility(View.GONE);
//			}
			view.setTag(position);
			textView.setText(list.get(position).get("name"));
			textDate.setText(list.get(position).get("time"));
			
		} catch (Exception e) { 
			// TODO: handle exception
		}
		return view;
	}

}
